package com.ruoyi.system.service.impl;

import java.math.BigDecimal;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OrderListMapper;
import com.ruoyi.system.domain.OrderList;
import com.ruoyi.system.service.IOrderListService;

import javax.annotation.Resource;

/**
 * 订单明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-05-24
 */
@Service
public class OrderListServiceImpl implements IOrderListService 
{
    @Resource
    private OrderListMapper orderListMapper;

    /**
     * 查询订单明细
     * 
     * @param id 订单明细主键
     * @return 订单明细
     */
    @Override
    public OrderList selectOrderListById(Integer id)
    {
        return orderListMapper.selectOrderListById(id);
    }

    /**
     * 查询订单明细列表
     * 
     * @param orderList 订单明细
     * @return 订单明细
     */
    @Override
    public List<OrderList> selectOrderListList(OrderList orderList)
    {
        return orderListMapper.selectOrderListList(orderList);
    }

    /**
     * 新增订单明细
     * 
     * @param orderList 订单明细
     * @return 结果
     */
    @Override
    public int insertOrderList(OrderList orderList)
    {
        return orderListMapper.insertOrderList(orderList);
    }

    /**
     * 修改订单明细
     * 
     * @param orderList 订单明细
     * @return 结果
     */
    @Override
    public int updateOrderList(OrderList orderList)
    {
        return orderListMapper.updateOrderList(orderList);
    }

    /**
     * 批量删除订单明细
     * 
     * @param ids 需要删除的订单明细主键
     * @return 结果
     */
    @Override
    public int deleteOrderListByIds(Integer[] ids)
    {
        return orderListMapper.deleteOrderListByIds(ids);
    }

    /**
     * 删除订单明细信息
     * 
     * @param id 订单明细主键
     * @return 结果
     */
    @Override
    public int deleteOrderListById(Integer id)
    {
        return orderListMapper.deleteOrderListById(id);
    }

    @Override
    public BigDecimal getKucunValue(String userId) {
//
//        List<OrderList> list =
//        BigDecimal count = new BigDecimal(0);
//        for (OrderList orderList : list) {
//            count = count.add(orderList.getOutPrice());
//        }

        return orderListMapper.getKucunValue(userId);
    }

    @Override
    public List<OrderList> selectOrderListNew(OrderList orderList) {
        return orderListMapper.selectOrderListNew(orderList);
    }
}
